<template>
  <div id="app">
    <muen v-if="logins != true" />
    <login v-else />
    <!-- <router-view /> -->
  </div>
</template>

<script>
import muen from "@/components/muen";
import login from "@/components/login";
import business from "@/utils/business";
export default {
  name: "App",
  provide() {
    //父组件中通过provide来提供变量，在子组件中通过inject来注入变量。
    return {
      reload: this.reload,
    };
  },
  data() {
    return {
      logins: true,
    };
  },
  components: {
    muen,
    login,
  },
  created() {
    this.getuser()
    let user = localStorage.getItem("name");
    this.logins = user == null ? true : false;
    
  },
  methods: {
    getuser() {
      business
        .showsetSeller({})
        .then((data) => {
          let dname = data.data.data
           this.$store.commit("setuname", dname[0].username);
        })
        .catch((error) => {
          return;
        });
    },
  },
};
</script>

<style>
@import "./assets/css/Animate.css";

.text-red {
  color: red !important;
}
.margin-left-xs {
  margin-left: 10px;
}
.margin-left-fxx {
  margin-left: -100px;
}
.flex {
  display: flex;
}
.flex-between {
  display: flex;
  justify-content: space-between;
}
.items-center {
  align-items: center;
}
.padding-sm {
  padding: 15px 0;
}
.margin-top-xs {
  margin-top: 15px;
}
</style>
